//
//  DHButtonCell.m
//  宏达APP
//
//  Created by DIANGHONG on 2018/5/5.
//  Copyright © 2018年 123. All rights reserved.
//

#import "DHButtonCell.h"
@interface DHButtonCell()
@property (weak, nonatomic) IBOutlet UIButton *button;

@end

@implementation DHButtonCell

- (void)setClearArea:(DHClearArea *)clearArea
{
    _clearArea = clearArea;
    
    
    
    [self.button setTitle:self.clearArea.name forState:UIControlStateNormal];

}

- (void)awakeFromNib{
    [super awakeFromNib];

    [self.button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)buttonClick:(UIButton *)sender
{
    sender.selected = !sender.isSelected;
    
    if (!self.clearArea) {return;}
    sender.isSelected ? [NSNotificationCenter.defaultCenter postNotificationName:kClearAreaNotification object:nil userInfo:@{@"clearAreaID":self.clearArea.ID}] : nil;
}





@end
